﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init {
    import flash.events.*;
    import Engine.Init.*;
    import Classes.util.*;
    import plugin.*;

    public class ConsoleInit extends InitializationAction {

        public static const INIT_ID:String = "ConsoleInit";

        public function ConsoleInit(){
            super(INIT_ID);
            addDependency(ServiceInit.INIT_ID);
            addDependency(UIInit.INIT_ID);
        }
        override public function execute():void{
            var _local2:XML;
            var _local3:XML;
            var _local4:String;
            var _local5:PluginLoader;
            var _local1:XML = Global.bootstrap.setting;
            if (((Config.DEBUG_MODE) && ((_local1.bootstrap.length() > 0)))){
                _local2 = _local1.bootstrap[0];
                if (_local2.plugins.length() > 0){
                    for each (_local3 in _local2.plugins.plugin) {
                        if (_local3.attribute("type").toString() == "console"){
                            _local4 = _local3.attribute("locator").toString();
                            _local5 = new PluginLoader(_local4);
                            _local5.load(this.onConsoleLoaded);
                            return;
                        };
                    };
                };
            };
            this.onConsoleLoaded(null);
        }
        private function onConsoleLoaded(_arg1:Event):void{
            if (((_arg1) && (_arg1.target.content))){
                ConsoleStub.install(_arg1.target.content);
                ConsoleHelper.activate();
            };
            dispatchEvent(new Event(Event.COMPLETE));
        }

    }
}//package Init 
